package com.ict.web.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ict.common.annotation.Excel;
import com.ict.common.utils.bean.BeanUtils;
import com.ict.common.utils.uuid.IdUtils;
import com.ict.web.controller.file.domain.YzqFile;
import com.ict.web.domain.Compliance;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Date;

@Data
public class ComplianceAddDto {

    /** 项目id */
    @ApiModelProperty(value = "项目id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @NotNull(message = "项目id不能为空")
    private Long proId;

    /** 试运行开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "试运行开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date tryTime;

    /** 政务云部署 */
    @Excel(name = "政务云部署")
    private String deploymentMode;

    /** 安全评测 */
    @Excel(name = "安全评测")
    private String safetyEvaluation;

    /** 是否按照方案实现数据源共享:{0:是;1:否;} */
    @Excel(name = "是否按照方案实现数据源共享:{0:是;1:否;}")
    private String isAccord;

    /** 系统整合 */
    @Excel(name = "系统整合")
    private String systemIntegration;

    /** 试运行效果描述 */
    @Excel(name = "试运行效果描述")
    private String tryEffectDescription;

    /** 试运行效果描述证明材料 */
    @Excel(name = "试运行效果描述证明材料")
    private YzqFile tryEffectDescriptionStuff;

    /**
     * 将 ProjectManagementAddDto 转化为 ProjectManagement
     *
     * @param dto 接收dto
     * @return HotelInfo
     */
    public static Compliance of(ComplianceAddDto dto){
        Compliance bean = new Compliance();
        BeanUtils.copyProperties(dto,bean);

        //设置ID
        bean.setComplianceId(IdUtils.snowId());
        //设置创建时间
        bean.setCreateTime(LocalDateTime.now());
        //设置创建时间
        bean.setUpdateTime(LocalDateTime.now());
        //设置物理删除标记
        bean.setIsDelete("0");

        return bean;
    }
}
